﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Base.Users;


namespace Base.Abstract
{
	public abstract class AbstractTpObject
	{
		#region Construction

		protected static AbstractTpObject projectInstance = null;

		public static AbstractTpObject Instance
		{
			get
			{
				if (projectInstance == null)
				{
					throw new Exception("Project.Instance must be called first");
				}
				return projectInstance;
			}
		}

		#endregion

		#region Properties

		public virtual string Name
		{
			get;
			set;
		}

		private User currentUser;
		public User CurrentUser
		{
			get
			{
				return currentUser;
			}
			set
			{
				currentUser = value;

				//Load ProductType Preferences
				//if(currentUser != null) {
				//    currentUser.InitializeProductTypePreferences();
				//}
			}
		}

		public bool IsLoggedIn
		{
			get
			{
				return CurrentUser != null;
			}
		}

		public List<AbstractTpObject> TreeJournalObservers
		{
			get;
			set;
		}

		#endregion
	}
}
